package view;




import controller.Validation;
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		model.DataHandler handler;
		Validation val;
		
		//System.out.println(handler.getList().size());
		//val.testKNN(handler.getList());
		BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			System.out.println("What file do you want to use? \n Enter 0 for pima.csv \n 1 for pima-CFS.csv or\n 9 or something stupid to exit");
			String line=null;
			int decicion=0;
			try{
				line = console.readLine();
				if (line.equals("something stupid")){
					stupid();
					break;
				}				decicion=Integer.parseInt(line);
			}
			catch(Exception e){
				
			} 
			if (decicion==0){
				handler = new model.DataHandler();
				handler.readFile("pima.csv");
				
			}
			else if(decicion==1){
				handler = new model.DataHandler();
				handler.readFile("pima-CFS.csv");
			}
			else{
				break;
			}
			System.out.println("0: Bayes \n 1: 1Knn \n 2: 5Knn\n3: WriteFolds \n 9 or something stupid to exit");
			try{
				line = console.readLine();
				if (line.equals("something stupid")){
					stupid();
					break;
				}
				decicion=Integer.parseInt(line);

			}
			catch(Exception e){
				
			} 
			if (decicion==0){
				long runtime=System.currentTimeMillis();
				val = new Validation();
				val.testBayes(handler.getList());
				runtime=System.currentTimeMillis()-runtime;
				double runtimeS = (double)runtime/1000;
				System.out.println(runtimeS+"s");
			}
			else if (decicion==1){
				long runtime=System.currentTimeMillis();
				val = new Validation();
				val.testKNN(handler.getList(),1);
				runtime=System.currentTimeMillis()-runtime;
				double runtimeS = (double)runtime/1000;
				System.out.println(runtimeS+"s");
				}
			else if (decicion==2){
				long runtime=System.currentTimeMillis();
				val = new Validation();
				val.testKNN(handler.getList(),5);
				runtime=System.currentTimeMillis()-runtime;
				double runtimeS = (double)runtime/1000;
				System.out.println(runtimeS+"s");
				}
			else if (decicion==3){
				val = new Validation();
				val.printFolds(handler.getList());
			}
			else{
				break;
			}
		}
		
	}

	public static void stupid(){
		System.out.println
("                                 __ \n"+ 
"                       _ ,___,-'\",-=-.\n"+ 
"           __,-- _ _,-'_)_  (\"\"`'-._\\ `.\n"+ 
"        _,'  __ |,' ,-' __)  ,-     /. |\n"+ 
"      ,'_,--'   |     -'  _)/         `\\\n"+ 
"    ,','      ,'       ,-'_,`           :\n"+ 
"    ,'     ,-'       ,(,-(              :\n"+ 
"         ,'       ,-' ,    _            ; \n"+ 
"         /        ,-._/`---'            /\n"+ 
"        /        (____)(----. )       ,'\n"+ 
"       /         (      `.__,     /\\ /,\n"+ 
"      :           ;-.___         /__\\/|\n"+ 
"      |         ,'      `--.      -,\\ |\n"+ 
"      :        /            \\    .__/ \n"+ 
"       \\      (__            \\    |_\n"+ 
"        \\       ,`-, *       /   _|,\\\n"+ 
"         \\    ,'   `-.     ,'_,-'    \\\n"+ 
"        (_\\,-'    ,'\")--,'-'       __\\\n"+ 
"         \\       /  // ,'|      ,--'  `-.\n"+ 
"          `-.    `-/ \\'  |   _,'         `.\n"+ 
"             `-._ /      `--'/             \\\n"+ 
"     -ouh-      ,'           |              \\\n"+ 
"               /             |               \\\n"+ 
"            ,-'              |               /\n"+ 
"           /                 |             -' ");
	}
}
